/**
 * 兼容性封装
 * 文档的总高度
 * @param targetElement 可以指定目标元素
 * @returns {number}
 */
export default function getScrollHeight(targetElement){
    var scrollHeight = 0, bodyScrollHeight = 0, documentScrollHeight = 0;
    if(targetElement){
        scrollHeight=targetElement.scrollHeight;
    }else {
        if (document.body) {
            bodyScrollHeight = document.body.scrollHeight;
        }
        if (document.documentElement) {
            documentScrollHeight = document.documentElement.scrollHeight;
        }
        scrollHeight = (bodyScrollHeight - documentScrollHeight > 0) ? bodyScrollHeight : documentScrollHeight;
    }
    return scrollHeight;
}